﻿using OnlineAuction.Common;
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Text;

namespace OnlineAuction.DataAccess
{
    public class AuctionTypeDA
    {
        public DataSet GetAuctionType()
        {
            //Get connecion of database
            SqlConnection conn;
            Database db = new Database();
            using (conn = db.GetConnection())
            {
                //Get Auction type from database
                try
                {
                    conn.Open();
                    DataSet ds = new DataSet();
                    SqlDataAdapter da = new SqlDataAdapter("GetAuctionType", conn);
                    da.SelectCommand.CommandType = CommandType.StoredProcedure;
                    da.Fill(ds);
                    conn.Close();
                    return ds;
                }
                catch
                {
                    conn.Close();
                    return null;
                }
                finally
                {
                    conn.Dispose();
                }
            }
        }
    }
}
